package com.ridanlabs.professorwebsite.validation;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

import com.ridanlabs.professorwebsite.general.Authority;

public class UserTypeValidator implements ConstraintValidator<UserType, String> {

	@Override
	public void initialize(UserType constraintAnnotation) { }

	@Override
	public boolean isValid(String value, ConstraintValidatorContext context) {
		
		if( Authority.fromString( value ) == null )
			return false;
				
		return true;
	}
}
